home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
011
/
asysend.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-06-03
|
2KB
|
71 lines
(*----------------------------------------------------------------------*)
(* Async_Send --- Send character over communications port *)
(*----------------------------------------------------------------------*)
Procedure Async_Send( C : Char );
(* *)
(* Procedure: Async_Send *)
(* *)
(* Purpose: Sends character out over communications port *)
(* *)
(* Calling Sequence: *)
(* *)
(* Async_Send( C : Char ); *)
(* *)
(* C --- Character to send *)
(* *)
(* Calls: None *)
(* *)
Var
i : Integer;
m : Integer;
Counter : Integer;
Begin (* Async_Send *)
(* Turn on OUT2, DTR, and RTS *)
Port[UART_MCR + Async_Base] := $0B;
(* Wait for CTS using Busy Wait *)
Counter := MaxInt;
While ( Counter <> 0 ) AND
( ( Port[UART_MSR + Async_Base] AND $10 ) = 0 ) Do
Counter := Counter - 1;
(* Wait for Transmit Hold Register Empty (THRE) *)
If Counter <> 0 Then Counter := MaxInt;
While ( Counter <> 0 ) AND
( ( Port[UART_LSR + Async_Base] AND $20 ) = 0 ) Do
Counter := Counter - 1;
(* Send the character if port clear *)
If Counter <> 0 Then
Begin (* Send the Character *)
Inline($FA); (* CLI --- disable interrupts *)
Port[UART_THR + Async_Base] := Ord(C);
Inline($FB); (* STI --- enable interrupts *)
End (* Send the Character *)
Else (* Timed Out *)
Writeln('<<<TIMEOUT>>>');
End (* Async_Send *);
End (* Send the Character *)
Else (* Timed Out *)
Writeln('<<<TIMEOUT>>>');
End (